/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Peer;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.UnknownHostException;
import java.util.ArrayList;
import model.PeerEntity;

/**
 *
 * @author user
 */
public class peer2 {

    public static void main(String[] args) throws UnknownHostException, InterruptedException, FileNotFoundException, IOException, IllegalAccessException, InstantiationException {
//        PeerEntity peer2 = new PeerEntity(1235);
//        peer2.addPortTCP(5321,"piece");
//        peer2.addPortTCP(5322,"bitField");
//        peer2.addPortTCP(5323,"piece");
//        peer2.addPortTCP(5324,"bitField");
    //ngirim
//        byte[] b = new byte[4];
//        b[0] = 11;
//        b[1] = 12;
//        b[2] = 13;
//        b[3] = 14;

//        peer2.setHave(b);
//        peer2.setHandShake("dsfsfsfgdfgd");
        //dia tahu port mana yg mesti dituju-> dari database
//        peer2.startHandShake(4321);
//        Thread.currentThread().sleep(3000);
//        peer2.startHave();

//        peer2.setBlockRequest(11, 12, 13);
//        peer2.startCancel(4323);
//        Thread.currentThread().sleep(3000);
//         Thread.currentThread().sleep(3000);
//                Thread.currentThread().sleep(2000);
//        peer2.startBlockRequest(4322);
//                Thread.currentThread().sleep(2000);
//        peer2.startBlockRequest(4323);
//                Thread.currentThread().sleep(2000);
//        peer2.startBlockRequest(4324);
        //listen
         //peer2.handShakePeer(4321);
         //Thread.currentThread().sleep(3000);
        PeerDownloads pd2 = new PeerDownloads(new PeerEntity("127.0.0.1",1235,true));
        Thread t2 = new Thread(pd2);
        t2.start();
    }
}
